package com.situ.util.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.situ.util.service.OrdersService;
import com.situ.util.entity.Orders;
import com.situ.util.*;
/**
 * Orders的路由接口服务
 * 
 * @author 
 *
 */
@RestController
public class OrdersController {

	/** OrdersService服务 */
	@Autowired
	private OrdersService ordersService;
	
	/**
	 * 查询所有Orders数据的方法
	 * @param value
	 * @return
	 */
	@RequestMapping(value = "queryOrders", produces = {"application/json;charset=UTF-8"})
	public ResponseData find(Orders value) {

		return ResponseData.ok().putDataValue("list",ordersService.find(value));
	}
	
	/**
	 * 通过id查询Orders数据的方法
	 * @param id
	 * @return
	 */
	@RequestMapping(value = "queryOrdersById/{id}", produces = {"application/json;charset=UTF-8"})
	public ResponseData findOne(@PathVariable(name="id") Integer id) {
		 return ResponseData.ok().putDataValue("obj",ordersService.findOne(id));
	}
	
	/**
	 * 插入Orders属性不为空的数据方法
	 * @param id
	 * @return
	 */
	@RequestMapping(value = "saveOrders")
	public ResponseData save(Orders value) {
		return ResponseData.ok().putDataValue("obj", ordersService.saveNotNull(value));
	}
	
	/**
	 * 更新Orders属性不为空的数据方法
	 * @param id
	 * @return
	 */
	@RequestMapping(value = "updateOrders", produces = {"application/json;charset=UTF-8"})
	public ResponseData update(Orders value) {
		return ResponseData.ok().putDataValue("obj",ordersService.updateNotNullById(value));
	}

	/**
	 * 通过id删除Orders数据方法
	 * @param id
	 * @return
	 */
	@RequestMapping(value = "delOrdersById/{id}", produces = {"application/json;charset=UTF-8"})
	public ResponseData delete(@PathVariable(name="id") Integer id) {
		return ResponseData.ok().putDataValue("obj",ordersService.deleteById(id));
	}


}
